package com.example.show2page.mapper;

import com.example.show2page.pojo.PageVO;
import com.example.show2page.pojo.TableData;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author Hacah
 * @date 2021/4/23 10:32
 */
public interface TableDataMapper extends Mapper<TableData> {

    /**
     * 获取所有的系统名，重复只保留一个
     *
     * @return
     */
    @Select("SELECT DISTINCT `YMC`\n" +
            "FROM `gdj_all_table_t`")
    List<String> selectAllDiffSysName();

    /**
     * 获取条件下所有的一级名，重复只保留一个
     *
     * @return
     */
    @Select("SELECT DISTINCT `1JGNMC`\n" +
            "FROM `gdj_all_table_t` where `YMC` =  #{sysName}\n")
    List<String> selectAllDiffLeve1(String sysName);

    /**
     * 获取条件下所有的是二级名，重复只保留一个
     *
     * @return
     */
    @Select("SELECT DISTINCT `2JGNMC`\n" +
            "FROM `gdj_all_table_t` where `YMC` =  #{sysName}\n" +
            "AND 1JGNMC = #{level1} \n")
    List<String> selectAllDiffLeve2(String sysName, String level1);

    /**
     * 获取条件下所有的三级名，重复只保留一个
     *
     * @return
     */
    @Select("SELECT DISTINCT `3JGNMC`\n" +
            "FROM `gdj_all_table_t` where `YMC` =  #{sysName}\n" +
            "AND 1JGNMC = #{level1} \n" +
            "AND 2JGNMC = #{level2} \n"
    )
    List<String> selectAllDiffLeve3(String sysName, String level1, String level2);

    /**
     * 获取条件下所有的四级名，重复只保留一个
     *
     * @return
     */
    @Select("SELECT DISTINCT `4JGNMC`\n" +
            "FROM `gdj_all_table_t` where `YMC` =  #{sysName}\n" +
            "AND 1JGNMC = #{level1} \n" +
            "AND 2JGNMC = #{level2} \n" +
            "AND 3JGNMC = #{level3}"
    )
    List<String> selectAllDiffLeve4(String sysName, String level1, String level2, String level3);


}
